﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace Kea
{
    public class DataPlanSeekable<T> : DataPlanJoinableBase<T> where T : TableReaderWriter<T>, new()
    {
        internal DataPlanSeekable() { }

        public DataPlanSeekable<T> IndexMatches(params object[] indexValues)
        {
            return new DataPlanSeekable<T>()
            {
                IndexName = IndexName,
                Filters = Filters,
                Comparer = Comparer,
                IndexValuesLowerLimit = indexValues,
                IndexValuesUpperLimit = indexValues
            };
        }
        public DataPlanSeekable<T> IndexGTE(params object[] indexValues)
        {
            return new DataPlanSeekable<T>()
            {
                IndexName = IndexName,
                Filters = Filters,
                Comparer = Comparer,
                IndexValuesLowerLimit = indexValues,
                IndexValuesUpperLimit = IndexValuesUpperLimit
            };
        }
        public DataPlanSeekable<T> IndexLTE(params object[] indexValues)
        {
            return new DataPlanSeekable<T>()
            {
                IndexName = IndexName,
                Filters = Filters,
                Comparer = Comparer,
                IndexValuesLowerLimit = IndexValuesLowerLimit,
                IndexValuesUpperLimit = indexValues
            };
        }
        public DataPlanSeekable<T> IndexBetween(object lowerRangeLimit, object upperRangeLimit)
        {
            return new DataPlanSeekable<T>()
            {
                IndexName = IndexName,
                Filters = Filters,
                Comparer = Comparer,
                IndexValuesLowerLimit = new object[] { lowerRangeLimit },
                IndexValuesUpperLimit = new object[] { upperRangeLimit }
            };
        }
        public DataPlanSeekable<T> IndexBetween(object upperRange1Limit, object upperRange2Limit, object lowerRange1Limit, object lowerRange2Limit)
        {
            return new DataPlanSeekable<T>()
            {
                IndexName = IndexName,
                Filters = Filters,
                Comparer = Comparer,
                IndexValuesLowerLimit = new object[] { lowerRange1Limit, lowerRange2Limit },
                IndexValuesUpperLimit = new object[] { upperRange1Limit, upperRange2Limit}
            };
        }
        public DataPlanSeekable<T> IndexBetween(object lowerRange1Limit, object lowerRange2Limit, object lowerRange3Limit, object upperRange1Limit, object upperRange2Limit, object upperRange3Limit)
        {
            return new DataPlanSeekable<T>()
            {
                IndexName = IndexName,
                Filters = Filters,
                Comparer = Comparer,
                IndexValuesLowerLimit = new object[] { lowerRange1Limit, lowerRange2Limit, lowerRange3Limit },
                IndexValuesUpperLimit = new object[] { upperRange1Limit, upperRange2Limit, upperRange3Limit }
            };
        }



    }
}